<template>
	<view class="tabbar">
		<view class="tab" v-for="(item,index) in tabbarList" :key="index" @tap='navigatorTo(item.pagePath)'>
			<image v-if="item.pagePath === 'release'" :src="item.iconPath" class="addIco" @click="to_release"></image>
			<view v-else>
				<image v-if="item.newName === cureentPage" :src="item.selectedIconPath"></image>
				<image v-else :src="item.iconPath"></image>
			</view>
			<view class="text"> {{item.text}} </view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				tabbarList: [{
						"newName": "index",
						"pagePath": "/pages/index/index",
						"iconPath": "/static/images/tabbar/index.png",
						"selectedIconPath": "/static/images/tabbar/index-selected.png",
						"text": "首页"
					},
					{
						"newName": "management",
						"pagePath": "/pages/management/index",
						"iconPath": "/static/images/tabbar/management.png",
						"selectedIconPath": "/static/images/tabbar/wmanagement-selected.png",
						"text": "出入库管理"
					},
					{
						"newName": "warehouse",
						"pagePath": "/pages/warehouse/index",
						"iconPath": "/static/images/tabbar/warehouse.png",
						"selectedIconPath": "/static/images/tabbar/warehouse-selected.png",
						"text": "订单管理",
					},
					{
						"newName": "mine",
						"pagePath": "/pages/center/index",
						"iconPath": "/static/images/tabbar/center.png",
						"selectedIconPath": "/static/images/tabbar/center-selected.png",
						"text": "我的"
					}
				]
			}
		},
		props: {
			cureentPage: {
				type: String,
				default: 'index'
			}
		},
		methods: {
			navigatorTo(path) {
				uni.reLaunch({
					url: path
				})
			}
		}
	}




	// const to_release=()=>{ //跳转发布页面
	// 	uni.navigateTo({
	// 		url:"/pages/release/release"
	// 	})
	// }
	// const tabbarList=[  //自己定义的tabber
	// 	{
	// 		"pagePath": "ages/index/index",
	// 		"iconPath": "static/images/tabbar/index.png",
	// 		"selectedIconPath": "static/images/tabbar/index-selected.png",
	// 		"text": "首页"
	// 	},
	// 	{
	// 		"pagePath": "pages/center/index",
	// 		"iconPath": "static/images/tabbar/center.png",
	// 		"selectedIconPath": "static/images/tabbar/center-selected.png",
	// 		"text": "我的"
	// 	}

	// ]

	// const navigatorTo=(e)=>{  //当点击下方tabbar跳转指定页面
	// 	console.log(e);
	// 		uni.redirectTo({
	// 			url:`../../pages/${e}/${e}`
	// 		})
	// }
</script>

<style scoped>
	.tabbar {
		/* border-top:1rpx solid #c5c4c5; */
		background-color: #eee;
		z-index: 9;
		position: fixed;
		left: 0;
		bottom: 0;
		width: 100%;
		height: 120rpx;
		display: flex;
		justify-content: space-around;
		align-items: center;
	}

	.tab {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}

	image {
		width: 50rpx;
		height: 50rpx;
	}

	.addIco {
		width: 50px;
		height: 50px;
	}
</style>